from base import Yaml, Path
from page.personage.personal_center_page import PersonalCenterPage


class SingleTicketOrderPage(PersonalCenterPage):
    """单票下单页面"""
    __config = Yaml.get_config_as_dict(Path.get_actual_path_by_current_file(__file__, "personage.yaml"))[
        "SingleTicketOrderPage"]

    def single_ticket_order_page(self,good_name,
                                 weight, count):
        """
        单票下单流程
        :param receipt_company: 收方公司
        :param the_recipient:收件人
        :param receiving_number:收件人联系手机
        :param detailed_address:收件人详细地址
        :param good_name:托寄物名称
        :param weight:重量
        :param count:数量
        :return:
        """
        self._driver.click(self.__config["ADDRESS_BOOK"])

        self._driver.click(self.__config["SITE"])
        self._driver.click(self.__config["CONFIRM_THE_ADDRESS"])
        # self._driver.type(self.__config["DETAILED_ADDRESS"], detailed_address)
        self._driver.type(self.__config["GOOD_NAME"], good_name)
        self._driver.type(self.__config["WEIGHT"], weight)
        self._driver.type(self.__config["COUNT"], count)

        self._driver.click(self.__config["PAYMENT_METHOD_INPUT_BOX"])
        self._driver.click(self.__config["PAYMENT_METHOD"])
        self._driver.click(self.__config["SERVICE_MODE"],seconds=2)
        self._driver.click(self.__config["SERVICE_MODE_SELECT"])
        self._driver.click(self.__config["PICKUP_TIME"])
        self._driver.click(self.__config["AT_THE_MOMENT"])
        self._driver.click(self.__config["PROTOCOL"])
        self._driver.click(self.__config["SUBMIT"])
